package com.mav01.mrpbackend.mapper;

import com.mav01.mrpbackend.pojo.Allocation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AllocationMapper {

    @Select("SELECT * FROM Allocation WHERE parent_material_no = #{parentMaterialNo}")
    List<Allocation> selectByParentMaterialNo(String parentMaterialNo);

    @Select("SELECT * FROM Allocation")
    List<Allocation> selectAll();

    @Select("SELECT * FROM Allocation WHERE parent_material_no = #{parentMaterialNo} AND child_material_no = #{childMaterialNo}")
    Allocation selectByParentAndChild(@Param("parentMaterialNo") String parentMaterialNo,
                                      @Param("childMaterialNo") String childMaterialNo);
}